#include <stdio.h>

int main(){
	int T,n,m,x1,y1,x2,y2;
	scanf("%d", &T);
	while (T){
		scanf(" %d %d %d %d %d %d", &n, &m, &x1, &y1, &x2, &y2);
		if (x1<=x2 && y1<=y2){
			printf("%d\n", x2-x1+y2-y1);		
		}else {
			printf("Single dog!\n");
		}
		T--;
	}
	return 0;
}
